package com.future.hair.server.mapper;

import com.future.hair.server.entity.UserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.future.hair.server.custom.Vo.UserInfoVo;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author future-RogueYBJ
 * @since 2020-05-23
 */
public interface UserInfoMapper extends BaseMapper<UserInfo> {
    @Select("SELECT ui.*,u.*,m.* FROM user_info ui LEFT JOIN `user` u ON ui.user_id=u.id LEFT JOIN `mall` m ON ui.mall_id=m.id")
    List<UserInfoVo> managerUserInfoUserList();

    @Select("SELECT ui.*,u.*,m.* FROM user_info ui LEFT JOIN `user` u ON ui.user_id=u.id LEFT JOIN `mall` m ON ui.mall_id=m.id  WHERE mall_id=#{mallId}")
    List<UserInfoVo> userInfoUserList(@Param("mallId") Integer mallId);

    @Select("SELECT ui.*,u.*,m.* FROM user_info ui LEFT JOIN `user` u ON ui.user_id=u.id LEFT JOIN `mall` m ON ui.mall_id=m.id WHERE ui.id=#{id}")
    UserInfoVo userInfoUser(@Param("id") Integer id);
}
